﻿using System.Configuration;

namespace Altairis.Nemesis.Gallery.Configuration {

    public class GallerySection : ConfigurationSection {

        public static GallerySection GetCurrentOrDefault() {
            return (ConfigurationManager.GetSection("altairis.nemesis.gallery") as GallerySection) ?? new GallerySection();
        }

        [ConfigurationProperty("thumbnails", IsRequired = true, IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(ThumbnailsElement), AddItemName = "size")]
        public ThumbnailsElement Thumbnails {
            get { return (ThumbnailsElement)this["thumbnails"]; }
            set { this["thumbnails"] = value; }
        }

        [ConfigurationProperty("directoryListing", IsRequired = false)]
        public DirectoryListingElement DirectoryListing {
            get { return (DirectoryListingElement)this["directoryListing"]; }
            set { this["directoryListing"] = value; }
        }

        [ConfigurationProperty("infoPage", IsRequired = false)]
        public InfoPageElement InfoPage {
            get { return (InfoPageElement)this["infoPage"]; }
            set { this["infoPage"] = value; }
        }

        [ConfigurationProperty("templateParameters", IsRequired = false)]
        [ConfigurationCollection(typeof(TemplateParameterCollection))]
        public TemplateParameterCollection TemplateParameters {
            get { return (TemplateParameterCollection)this["templateParameters"]; }
            set { this["templateParameters"] = value; }
        }

    }

}